
README — Build the analysis panel from raw files
================================================

This step reconstructs `data.xlsx` (and a CSV mirror) from the three raw Excel files.

Inputs (place in the same folder as this do-file):
- CNRDS_green_patents.xlsx
- CSMAR_finance_data.xlsx
- GovWorkReports_count_summary..xlsx

How to run (in Stata):
1) cd "path/to/your/folder"
2) do build_panel.do

What the script does:
- CNRDS: filters to “上市公司本身” (if available), sums green patent applications
  (GreInvia + GreUmia + GreInvja + GreUmja), and builds GI = ln(1 + applications).
- CSMAR: standardizes firm/year and common controls (Size, Age, Lev, ROA, RD, SOE, Board);
  passes through industry code/name and ST/PT flags if present.
- Government Work Reports: standardizes year and central ESGP/Slack/MEA.
- Merges the three sources by firm-year (and year for ESGP/Slack/MEA).
- Saves `data.xlsx` with variables in the order used by the paper, and `panel_planA.csv`.

Notes:
- The do-file tries multiple candidate column names. If your column names differ,
  open the do-file and add your actual names to the candidate lists near `_try_rename_if_missing`.
- No scaling is applied here (e.g., ×100). The analysis do-file handles unit conversions.
- Logs are written to `build_panel_log.txt` for auditing.
